package weaver.formmode.qz;

import org.apache.commons.lang3.StringUtils;
import weaver.conn.RecordSet;
import weaver.formmode.customjavacode.AbstractModeExpandJavaCodeNew;
import weaver.general.BaseBean;
import weaver.soa.workflow.request.RequestInfo;

import java.util.HashMap;
import java.util.Map;

/**
 * @version 1.0
 * @Title ecology-9
 * @Company 泛微软件
 * @CreateDate 2025/1/14
 * @Description 额外计算
 * @Author AdminZm
 */
public class ExtraCountModeExpand extends AbstractModeExpandJavaCodeNew {

    BaseBean baseBean = new BaseBean();

    @Override
    public Map<String, String> doModeExpand(Map<String, Object> param) {
        Map<String, String> result = new HashMap<>();
        RequestInfo requestInfo = (RequestInfo) param.get("RequestInfo");
        RecordSet rs = new RecordSet();
        RecordSet rs1 = new RecordSet();
        if (requestInfo != null) {
            try {
                String id = requestInfo.getRequestid();
                rs.executeQuery("SELECT jjsjfped FROM uf_jjfpry WHERE id = ?", id);
                while (rs.next()) {
                    String jjsjfped = rs.getString("jjsjfped");
                    if (StringUtils.isEmpty(jjsjfped)) {
                        rs1.executeUpdate("UPDATE uf_jjfpry SET jjsjfped = ?, jjcbtx = 0, zdxjfpded = ?, sjzfpje = ?, bmglxsjzfpje = ? WHERE id = ?", 0.00, 0.00, 0.00, 0.00, id);
                    }
                }
            } catch (Exception e) {
                baseBean.writeLog("BonusShareBatchImportModeExpand error:" + e.getMessage());
            }
        }
        return result;
    }
}
